home *** CD-ROM | disk | FTP | other *** search
- ;FILE :FINDFILE.ASM
- ;USEAGE :call FINDFILE("Pathname<wildcards optional>"+CHR$(0),search%,exist%)
- ;Search% is the file attribute byte used in search
- ;RETURNS:Exist=-1 if file does exist, 0 if it does not.
- findfile segment
- assume cs:findfile
- push bp ;Standard stuff.
- mov bp,sp
- push ds
-
- mov dx,ds:[0] ;Current string segment.
- push dx
- pop ds ;THERE! String's segment is ds.
-
- les di,[bp+0eh] ;String descripter's pointer
- mov dx,es:[di+2] ;offset of string in DS seg.
-
- les di,[bp+0ah] ;Pointer to Search%
- mov cx,es:[di] ;Value of search%
-
- mov ah,04eh ;Request Find First/Matching
- xor si,si ;Let's use SI for return value 0=not found
- int 021h ;Involk MSDOS
-
- jb notfnd ;Jump if there was a problem finding a match
- dec si ;Found file, make it true(-1)
- notfnd: les di,[bp+06h] ;Pointer to result integer exist%
- mov es:[di],si ;store value into exist%
-
- pop ds ;Restore DS
- pop bp ;Restore BP
- findfile ends
- end
-